<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="/index/login_in" method="post">
    姓名：<input name="name" type="text" value="bob"><br><br>
    密码：<input name="password" type="password" value="123"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="vericode" placeholder="验证码" style="width: 60px">&nbsp;&nbsp;
    <img id="vericodeImg" src="/imageCode">&nbsp;&nbsp;
    <a id="kanbuq" href="javascript:changeImg();">看不清，换一张</a><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" value="提交"><br>
</form>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
    function changeImg() {
        //需要让每次请求的url都发生变化。否则服务器会认为访问的时一张图片，就不会刷新请求了
        //每次url一样，服务器会认为访问的url是同一张图片，没变化啊
        $("#vericodeImg").attr("src", "imageCode?" + Math.random())
    }
</script>
</body>
</html>
